package rpcdemo

import (
	"errors"
	"log"
)

type SmsService struct{}

type Args struct {
	Message string
}

type DivArgs struct {
	A, B int
}

func (SmsService) Send(args Args, reply *string) error {
	*reply = "send sms: " + args.Message
	return nil
}

func (SmsService) Div(args DivArgs, reply *float32) error {
	log.Printf("div %d / %d", args.A, args.B)
	if args.B == 0 {
		return errors.New("divide by zero")
	}
	*reply = float32(args.A) / float32(args.B)
	return nil
}
